\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{exercises}[2024/03/29 exercises class]

\RequirePackage{xkeyval}
\newif\ifslide
\DeclareOptionX{slide}{\slidetrue}
\DeclareOptionX*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptionsX*\relax
\LoadClass{article}

\RequirePackage{geometry}
\ifslide
  \geometry{paperwidth=126mm,paperheight=96mm,hmargin={1.5em,1em},vmargin={1em,1em}}
\else
  \geometry{b5paper,margin=2cm}
\fi
\geometry{marginparsep=2pt}


\newcounter{chapter}
\counterwithin{section}{chapter}

\input{common.sty}

\counterwithout{equation}{section}
\counterwithin*{equation}{section}

\newcommand{\extitle}[3][]{
\ifthenelse{\equal{#1}{}}{
\title{\Large\bfseries\sffamily 第 #2 章\quad #3}\setcounter{chapter}{#2}\setcounter{section}{-1}\stepcounter{section}}
  {\title{\Large\bfseries\sffamily 参考答案}\setcounter{chapter}{#2}\setcounter{section}{-1}\stepcounter{section}}
\maketitle
}

